<template>
    <div class="container">
        <h3>贷款管理</h3>


       <el-table
           :data="tableData"
           border
           style="margin-top:20px;"
           ref="multipleTable"
           header-cell-class-name="table-header"
       >
           <el-table-column prop="name" sortable label="申请人"></el-table-column>
           <el-table-column prop="createTime" sortable label="申请时间"></el-table-column>
           <el-table-column prop="amount" sortable label="申请金额"></el-table-column>
           <el-table-column prop="bankName" sortable label="放款银行"></el-table-column>
       	<el-table-column prop="loanPeriod" sortable label="还款周期"></el-table-column>
       	<el-table-column prop="surplusNum" sortable label="剩余周期"></el-table-column>
       	<el-table-column prop="repaidAmount" sortable label="已还金额"></el-table-column>
       	<el-table-column prop="surplusAmount" sortable label="剩余还款"></el-table-column>
       	<el-table-column prop="repaymentTime" sortable label="还款时间"></el-table-column>
           <el-table-column label="操作" width="150" align="center">
               <template slot-scope="scope">
                 <el-button
                     type="text"

                     @click="repayment(scope.$index, scope.row)"
                 >还款</el-button>
                   <el-button
                       type="text"

                       @click="handlecheckrepayment(scope.$index, scope.row)"
                   >查看</el-button>
               </template>
           </el-table-column>
       </el-table>
        <el-pagination
            layout="total, prev, pager, next, jumper"
            :page-size="pagesize"
            :current-page.sync="currentPage"
            :total="total"
            @current-change="handleCurrentChange"
            style="margin-top:20px"
        ></el-pagination>
    </div>
</template>
<script>
import axios from "axios"
export default {
    data() {
        return {
            added: true,
            total: 0,
            currentPage: 1,
            pagesize: 10,
            searchName: '',
            tableData: [],
            form: {},
            idx: -1,
            id: -1,
            boxCode: '',
            boxCode1: '',
            del: true,
            check: true,
            edit: true,
            action: ''
        };
    },
    mounted() {
        this.init();
        // this.judgmentAuthority()
    },
    methods: {
		// 贷款管理查看
		handlecheckrepayment(index,row){
			this.$router.push({
			    path: '/systemSetupFinance/checkrepayment',
			    query: {
			        id: row.id
			    }
			});
		},
      //还款
      repayment(index,row){
      	this.$router.push({
      	    path: '/systemSetupFinance/repayment',
      	    query: {
      	        id: row.id
      	    }
      	});
      },
        handleCurrentChange(val) {
            this.currentPage = val;
            this.init();
        },
        init() {
           let data = {
           	page:this.currentPage
           }
           axios.post("http://grove.cpzsyun.com:81/api/control/loanInfo/findListRepay",data).then((res)=>{
           // axios.post("http://grove.cpzsyun.com:81/api/control/loanInfo/findListRepay",data).then((res)=>{
           	this.tableData = res.data.rows
           	this.total = res.data.total
           	for(let i = 0 ; i<this.tableData1.length;i++){
           		this.tableData[i].createTime = this.tableData[i].createTime.substring(0,10)
           	}
           })
        },
        handleCheck(index, row) {
            // this.$router.push({
            //     path: '/inputs/check',
            //     query: {
            //         id: row.id
            //     }
            // });
        },
        //搜索
        handleSearch() {
            this.currentPage = 1;
            this.init();
        },
    }
};
</script>

<style scoped lang="less">
/deep/.upload-daoru {
    background: #eee;
    .el-upload {
        border: none;
        width: auto;
        height: auto;
        border-radius: 0;
        float: right;
        margin-right: 10px;
    }
}
.el-table {
    margin-top: 20px;
}
.el-pagination {
    text-align: center;
}
.el-pagination {
    text-align: center;
}
.el-col {
    margin-bottom: 0;
}
.avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    width:180px;
    overflow: hidden;
  }

  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .el-upload--text{
      width:180px;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
</style>
